package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.Spo2Entity

@Dao
interface Spo2Dao {

    @Insert
    suspend fun insert(spo2Entity: Spo2Entity)

    @Update
    suspend fun update(spo2Entity: Spo2Entity)

    @Delete
    suspend fun delete(spo2Entity: Spo2Entity)

    @Query("DELETE FROM spo2Measure")
    suspend fun deleteAll()

    @Query("SELECT * FROM spo2Measure")
    fun getSpo2(): LiveData<List<Spo2Entity>>

    @Query("SELECT * FROM spo2Measure WHERE timeLong >:before and timeLong <:after")
    fun getSpo2ByTime(before: Long, after: Long): LiveData<List<Spo2Entity>>
}